Skip to content

Conversation

@tiwarishubham635
Copy link
Contributor

@tiwarishubham635 tiwarishubham635 commented Nov 11, 2025

Fixes DII-2111

Adding Token Pagination strategy

  1. Add new class TokenPaginationPage that extends existing Page class
  2. Override the previous and next page urls in this file
  3. Add unit tests

Checklist

  • I acknowledge that all my contributions will be made under the project's license
  • I have made a material change to the repo (functionality, testing, spelling, grammar)
  • I have read the Contribution Guidelines and my PR follows them
  • I have titled the PR appropriately
  • I have updated my branch with the main branch
  • I have added tests that prove my fix is effective or that my feature works
  • I have added the necessary documentation about the functionality in the appropriate .md file
  • I have added inline documentation to the code I modified

If you have questions, please file a support ticket, or create a GitHub Issue in this repository.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds support for token-based pagination strategy to the Twilio PHP SDK by introducing a new TokenPaginationPage class that extends the existing Page class. This allows handling of APIs that use nextToken and previousToken instead of URL-based pagination.

Key Changes:

  • Introduced TokenPaginationPage class with token-based URL construction logic
  • Added KeyErrorException for handling missing metadata keys
  • Added comprehensive unit tests and integration test to verify streaming behavior

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 15 comments.

File Description
src/Twilio/TokenPaginationPage.php New abstract class implementing token-based pagination by overriding URL generation methods to construct URLs with pageSize and pageToken query parameters
src/Twilio/Exceptions/KeyErrorException.php New exception class for handling cases where required 'key' metadata is missing from API responses
tests/Twilio/Unit/TokenPaginationPageTest.php Comprehensive unit tests covering constructor, URL generation, query string building, and edge cases for the TokenPaginationPage class
tests/Twilio/Unit/VersionTest.php Added integration test using TestTokenPage to verify token pagination works correctly with the existing Version.stream() method

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated 7 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated 12 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@sonarqubecloud
Copy link

@tiwarishubham635 tiwarishubham635 merged commit 2f2836f into main Nov 27, 2025
39 checks passed
@tiwarishubham635 tiwarishubham635 deleted the add_token_pagination branch November 27, 2025 07:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants